<template>
  <div class="panel pd20 main">
    <div class="msg">Hi,Admin,你已经是我们的正式会员</div>
    <div class="layui-row layui-col-space20">
      <div class="layui-col-md6">
        <div class="panel border">
          <div class="title">我的会员信息</div>
          <div class="content">
            <p>你的积分有：<span class="orange">{{userInfo.favs}}</span></p>
            <p>您当前为：<span class="orange">{{userInfo.isVip? 'VIP'+userInfo.isVip: '非VIP'}}</span></p>
          </div>
        </div>
      </div>
      <div class="layui-col-md6">
        <Sign class="border"></Sign>
      </div>
      <div class="layui-col-md12 mt20">
        <div class="panel border">
          <div class="title">快捷方式</div>
          <div class="content" style="height:auto">
            <ul class="layui-row layui-col-space10">
              <li class="layui-col-sm3 layui-col-xs4">
                <a href="">
                  <div class="layui-icon layui-icon-set shortcut"></div>
                  <span>修改密码</span>
                </a>
              </li>
              <li class="layui-col-sm3 layui-col-xs4">
                <a href="">
                  <div class="layui-icon layui-icon-set shortcut"></div>
                  <span>修改密码</span>
                </a>
              </li>
              <li class="layui-col-sm3 layui-col-xs4">
                <a href="">
                  <div class="layui-icon layui-icon-set shortcut"></div>
                  <span>修改密码</span>
                </a>
              </li>
              <li class="layui-col-sm3 layui-col-xs4">
                <a href="">
                  <div class="layui-icon layui-icon-set shortcut"></div>
                  <span>修改密码</span>
                </a>
              </li>
              <li class="layui-col-sm3 layui-col-xs4">
                <a href="">
                  <div class="layui-icon layui-icon-set shortcut"></div>
                  <span>修改密码</span>
                </a>
              </li>
            </ul>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Sign from '../sidebar/Sign'
import { getUserInfo } from '@/api/user'
export default {
  name: 'user-center',
  components: {
    Sign
  },
  mounted () {
    this.getinfo()
  },
  computed: {
    userInfo () {
      return this.$store.state.userInfo
    }
  },
  methods: {
    async getinfo () {
      const res = await getUserInfo({
        uid: this.userInfo._id
      })
      if (res.code === 200) {
        this.$store.commit('setUserInfo', res.data)
      } else {
        this.$pop('shake', res.msg)
      }
    }
  }
}
</script>

<style lang="scss" scoped>
@media (max-width: 768px) {
  .panel{
    &.main{
      margin: 0 !important;
    }
  }
}
.panel {
  color: #333;
  border-radius: 2px;
  background-color: #fff;
  transition: all .2s;
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
  &.main{
    margin: 0 0 10px 225px;
  }
}
.msg{
  background-color: #f8f8f8;
  color: #666;
  padding: 10px 15px;
  margin-bottom: 20px;
}
.border {
  border:1px solid #e6e6e6;
}
.pd20{
  padding: 20px;
}
.mt20{
  margin-top: -20px;
}
.title{
  height: 50px;
  line-height: 50px;
  padding: 0 15px;
  color: #333;
  border-bottom: 1px dotted #e9e9e9;
  font-size: 14px;
}
.content{
  padding: 18px 15px;
  height: 50px;
  line-height: 26px;
  font-size:14px;
  color: #666;
}
li {
  text-align: center;
  padding: 5px;
}
.shortcut{
  background-color: #2f9688;
  width: 100%;
  height: 60px;
  line-height: 60px;
  text-align: center;
  color: #fff;
  border-radius: 2px;
  font-size: 20px;
}
</style>
